/**
 * 
 */
package org.cuatrovientos.javakart;

import java.util.Random;

/**
 * @author drodrigo_martinez
 *
 */
public class Vehicle {
	protected String name;
	protected int speed;
	protected int acceleration;
	protected int grip;
	
	/**
	 * @param name
	 */
	public Vehicle(String name) {
		this.name = name;
		initialize();
	}

	/**
	 * 
	 */
	@Override
	public String toString() {
		return "Vehicle [name=" + name + ", speed=" + speed
				+ ", acceleration=" + acceleration + ", grip=" + grip + "]";
	}
	/**
	 * Initialize the properties with random values
	 */
	private void initialize(){
		Random random = new Random();
		int number=0;
		
		for (int i=0; i<18;i++){
			number = random.nextInt(2);
			switch (number){
			case 0:
				speed=speed+1;
				break;
			case 1:
				acceleration = acceleration+1;
				break;
			default:
				grip = grip +1;
			}
		}
	}
	/**
	 * Returns the movement of the vehicle
	 * @return
	 */
	public int move(){
		int aux =0;
		Random random = new Random();
		aux = speed + acceleration + random.nextInt(5);
		return aux;
	}
	/**
	 * Returns the maneuver of the vehicle
	 * @return 
	 */
	public int maneuver(){
		int aux =0;
		Random random = new Random();
		aux = grip + random.nextInt(5);
		return aux;
		
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the speed
	 */
	public int getSpeed() {
		return speed;
	}

	/**
	 * @param speed the speed to set
	 */
	public void setSpeed(int speed) {
		this.speed = speed;
	}

	/**
	 * @return the acceleration
	 */
	public int getAcceleration() {
		return acceleration;
	}

	/**
	 * @param acceleration the acceleration to set
	 */
	public void setAcceleration(int acceleration) {
		this.acceleration = acceleration;
	}

	/**
	 * @return the grip
	 */
	public int getGrip() {
		return grip;
	}

	/**
	 * @param grip the grip to set
	 */
	public void setGrip(int grip) {
		this.grip = grip;
	}
	
	
	
}
